<?php 
 $pageTitle = '地址';
 $pageId="page-address-list";
?>

@extends('ios.pageIndex')

@section('page-content')
<div class="content-padded">

  <div class="list-block media-list no-padded font-line">
	  <ul id="address-list">
	    <!-- Single chekbox item -->
	    @if (!empty($addresses))
		@foreach($addresses as $adrs)
	    <li id="address-checkbox-{{$adrs->id}}" class="address-checkbox" data-id='{{$adrs->id}}' data-mobile='{{$adrs->mobile}}' data-name='{{$adrs->name}}' 
			data-zipcode='{{$adrs->zipcode}}' data-street='{{$adrs->street}}'
			data-province_id='{{$adrs->province_id}}' data-city_id='{{$adrs->city_id}}' data-district_id='{{$adrs->district_id}}'>
	      <label class="label-checkbox item-content">
	        <!-- Checked by default -->
	        <div class="item-inner">
	          <div class="item-subtitle name">{{$adrs->name}}</div>
	          <div class="item-subtitle address">{{$adrs->province}} {{$adrs->city.$adrs->district.$adrs->street}}</div>
	          <div class="item-subtitle mobile">{{$adrs->mobile}}</div>
	          <div class="item-title-row text-right">
	          	<div></div>
	          	<div class="item-after"><a href="#" class="update-address">修改</a>&nbsp;|&nbsp;<a href="#" class="delete-address">删除</a></div>
	          </div>
	        </div>
	      </label>
	    </li>
	    @endforeach
		@endif
	  </ul>
	</div>
	<a href="#" class="button button-big m-button add-address">添加新地址</a>
</div>
@stop

@section("more-pages")
<div data-page="page-add-address" class="page navbar-fixed cached">
  <div class="navbar text-navbar">
	<div class="navbar-inner">
		<div class="left sliding">
			<!-- Right link contains only icon - additional "icon-only" class-->
		<a  href="#" class="link back"> <i class="icon icon-left"></i> 返回</a>
	</div>
	<div class="center sliding">
		添加/修改地址
	</div>
	</div>
 </div>
 <!-- Scrollable page content-->
 <div class="page-content">
    <div class="content-padded">
       <form class="ajax-submit"  id="add-address-form" name="add-address-form" method="post" action="{{URL::to('user/address/add')}}">
			 <div class="m-form-control">
			 	<label>姓名<span class="text-red">*</span></label>
			 	<input type="text" class="validate" id="name" name="name" 
							data-rules="required|max_length[32]" data-display="姓名" placeholder="输入姓名">
			 </div>
			 
			 <div class="m-form-control">
			 	<label>手机<span class="text-red">*</span></label>
			 	<input type="text" class="validate" id="mobile" name="mobile" 
			data-rules="required|mobile" data-display="手机号" placeholder="输入手机号">
			 </div>
			 
			 <div class="m-form-control">
			 	<label>邮政编码</label>
			 	<input type="text" class="validate" id="zipcode" name="zipcode" 
			data-rules="max_length[16]|alpha_numeric" data-display="邮政编码" placeholder="输入邮政编码">
			 </div>
			 <div class="m-form-control">
			 	<label>省/直辖市<span class="text-red">*</span></label>
			 	 <select id="province_id" name="province_id" class="validate cs-select cs-skin-elastic"></select>
			 </div>
			 <div class="m-form-control">
			 	<label>市<span class="text-red">*</span></span></label>
			    <select id="city_id" name="city_id" class="validate cs-select cs-skin-elastic">
			    </select>
			 </div>
			 <div class="m-form-control">
			 	<label>区/县<span class="text-red">*</label>
			    <select id="district_id" name="district_id" class="validate cs-select cs-skin-elastic">
			  </select>
			 </div>
			 
			 <div class="m-form-control">
			 	<label>详细地址<span class="text-red">*</span></label>
		 		<textarea  class="validate" id="street" name="street"
					data-rules="required|max_length[256]" data-display="详细地址" placeholder="请输入详细地址"></textarea>
			 </div>
	    	{{Form::token()}}
	    	<button type="submit" class="button button-big m-button">保存</button>
	  </form>
    </div>
 </div>
</div>
@stop

@section('script')
<script type="text/template7" id="addressTemplate">
<li class="address-checkbox-@{{id}}" data-id='@{{id}}' data-mobile='@{{mobile}}' data-name='@{{name}}' 
			data-zipcode='@{{zipcode}}' data-street='@{{street}}'
			data-province_id='@{{province_id}}' data-city_id='@{{city_id}}' data-district_id='@{{district_id}}'>
	      <label class="label-checkbox item-content">
	        <!-- Checked by default -->
	        <div class="item-inner">
	          <div class="item-subtitle name">@{{name}}</div>
	          <div class="item-subtitle address">@{{province}} @{{city}}@{{district}}@{{street}}</div>
	          <div class="item-subtitle mobile">@{{mobile}}</div>
	          <div class="item-title-row text-right">
	          	<div></div>
	          	<div class="item-after"><a href="#" class="update-address">修改</a>&nbsp;|&nbsp;<a href="#" class="delete-address">删除</a></div>
	          </div>
	        </div>
	      </label>
	    </li>
</script>
@stop